<template>
  <div class="home">
     <my-table :tableDate="list">
       <template #b="scope">
         <button @click="del(scope)">删除</button>
       </template>
     </my-table>
  </div>
</template>

<script>
// @ is an alias to /src
import { reactive,toRefs } from 'vue';
import MyTable from '../components/myTable.vue';
export default {
  name: 'Home',
  components: {
    MyTable

  },
  setup(props) {
    const data = reactive({
      list:[
        {name:'张三',age:18,hobby:'敲代码'},
        {name:'李四',age:28,hobby:'玩游戏'},
        {name:'王五',age:38,hobby:'打豆豆'},
        {name:'赵六',age:48,hobby:'睡觉'}
      ]
    })
    const del = (val) => {
      console.log(val);
    }
    return{
      ...toRefs(data),
      del
    }
  }
}
</script>
